﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SuperKinhLuan.Games.PeerChess.GameLib
{
    public struct Position : IEquatable<Position>
    {
        private int column, row;

        public int Column
        {
            get { return this.column; }
        }

        public int Row
        {
            get { return this.row; }
        }

        public Position(int row, int column)
        {
            if (row < 0)
            {
                throw new ArgumentOutOfRangeException("row");
            }

            if (column < 0)
            {
                throw new ArgumentOutOfRangeException("column");
            }

            this.row = row;
            this.column = column;
        }

        public bool Equals(Position p) 
        { 
            return p.Column == Column && p.Row == Row; 
        }

        public override int GetHashCode() 
        { 
            return (int)(Column * 3137 + Row); 
        }
    }
}